﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using FONCREAGROINTEGRAL.Models;

namespace FONCREAGROINTEGRAL.Controllers
{
    public class AcreditaVinculoFamiliarController : Controller
    {
        public SistIntFoncreagroEntities db = new SistIntFoncreagroEntities();
        //
        // GET: /AcreditaVinculoFamiliar/

        public ActionResult Index()
        {
            return View();
        }

        public ActionResult ListAll()
        {
            var query = db.ACREDITAVINCULOFAMILIARs;
            var result = (from x in query.ToList()
                          select new
                          {
                              NomAcreditaVinculofamiliar = x.descripcion,
                              idacreditavinculofamiliar = x.idacreditavinculofamiliar,
                              Codigo = x.codigo
                          });

            return Json(new { Data = result, Count = query.Count() }, JsonRequestBehavior.AllowGet);
        }

    }
}
